<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="content-type" content="text/html; charset=utf-8" />
    <title>编辑夺宝</title>
    <link href="${base}/resource/admin/css/common.css" rel="stylesheet" type="text/css" />
    <script type="text/javascript" src="${base}/resource/admin/js/jquery.js"></script>
    <script type="text/javascript">
        $().ready(function() {
            var $inputForm = $("#inputForm");
            [@flash_message /]
        });
    </script>
</head>
<body>
<div class="path">
    <a href="${base}/common/index">首页</a> &raquo;新增物流
</div>
<form id="inputForm" action="update" method="post" class="required-form" enctype="multipart/form-data"  onsubmit="return validateForm(this)">
    <input type="hidden" name="productId" value="${entity.productId}"/>
    <input type="hidden" name="id" value="${entity.id}"/>
    <table class="input">
        <tr>
            <th>
                <span class="requiredField">*</span>订单编号
            </th>
            <td>
                ${entity.sn}
            </td>
        </tr>
        <tr>
            <th>
                <span class="requiredField">*</span>订单商品
            </th>
            <td>
                ${entity.name}
            </td>
        </tr>
        <tr>
            <th>
                <span class="requiredField">*</span>订单商品描述
            </th>
            <td>
            ${entity.description}
            </td>
        </tr>
        <tr>
            <th>
                <span class="requiredField">*</span>夺宝商品
            </th>
            <td>
                <a href="/dbProduct/edit?id=${entity.productId}">${entity.name}</a>
            </td>
        </tr>
        <tr>
            <th>
                <span class="requiredField">*</span>所属夺宝期
            </th>
            <td>
              ${entity.timesNo}
            </td>
        </tr>
        <tr>
            <th>
                <span class="requiredField">*</span>购买份数
            </th>
            <td>
            ${entity.quantity}
            </td>
        </tr>
        <tr>
            <th>
                <span class="requiredField">*</span>付款金额
            </th>
            <td>
            ${entity.amount}
            </td>
        </tr>
        <tr>
            <th>
                <span class="requiredField">*</span>夺宝用户
            </th>
            <td>
            ${entity.memberId}
            </td>
        </tr>
        <tr>
            <th>
                <span class="requiredField">*</span>用户手机号
            </th>
            <td>
            ${entity.mobile}
            </td>
        </tr>
        <tr>
            <th>
                <span class="requiredField">*</span>ip
            </th>
            <td>
            ${entity.ip}
            </td>
        </tr>
        <tr>
            <th>
                <span class="requiredField">*</span>市区
            </th>
            <td>
            ${entity.fromAddress}
            </td>
        </tr>
        <tr>
            <th>
                <span class="requiredField">*</span>订单状态
            </th>
            <td>
            [#if entity.orderStatus==0]0已确认[/#if]
            [#if entity.orderStatus==1]1已完成[/#if]
            [#if entity.orderStatus==2]2已取消[/#if]
            </td>
        </tr>
        <tr>
            <th>
                <span class="requiredField">*</span>支付状态
            </th>
            <td>
            [#if entity.paymentStatus==0]0未支付[/#if]
            [#if entity.paymentStatus==1]1已支付[/#if]
            [#if entity.paymentStatus==2]2已退款[/#if]
            </td>
        </tr>
        <tr>
            <th>
                <span class="requiredField">*</span>是否中奖
            </th>
            <td>
            ${entity.isLottery}
            </td>
        </tr>
        <tr>
            <th>
                <span class="requiredField">*</span>用户夺宝码
            </th>
            <td>
                ${entity.codeInfo}
            </td>
        </tr>
        <tr>
            <th>
                <span class="requiredField">*</span>收件人
            </th>
            <td>
                ${entity.consignee}<span style="color: #cc0000;">(提交时间:${entity.shippingDate?string("yyyy-MM-dd HH:mm:ss")})</span>
            </td>
        </tr>
        <tr>
            <th>
                <span class="requiredField">*</span>收件地址
            </th>
            <td>
                 ${entity.areaName}&nbsp;${entity.address}
            </td>
        </tr>
        <tr>
            <th>
                <span class="requiredField">*</span>收件电话
            </th>
            <td>
               ${entity.phone}
            </td>
        </tr>
        <tr>
            <th>
                <span class="requiredField">*</span>物流方式
            </th>
            <td>
                <input type="text" class="text" name="shippingMethodName"/>
            </td>
        </tr>
        <tr>
            <th>
                <span class="requiredField">*</span>运单编号
            </th>
            <td>
                <input type="text" class="text" name="shippingSn"/>
            </td>
        </tr>
        <tr>
            <th>
                &nbsp;
            </th>
            <td>
                <input type="button" class="button button-submit" value="提交" />
            </td>
        </tr>
    </table>
</form>
<script type="text/javascript">
    $(function(){
        $(".button-submit").click(function(){
            var shippingName=$("input[name='shippingMethodName']").val();
            var shippingSn=$("input[name='shippingSn']").val();
            $.ajax({
                url: '/dbTimes/shippingUpdate',
                type: "POST",
                data: {
                    orderId: '${entity.id}',
                    shippingMethodName: shippingName,
                    shippingSn:shippingSn
                },
                dataType: "json",
                cache: false,
                success: function (message) {
                    if(message.type=='success'){
                        var index = parent.layer.getFrameIndex(window.name); //获取窗口索引
                        parent.$("#listForm").submit();
                        parent.layer.close(index);
                        return false;
                    }else{
                        alert(message.content);
                    }
                }, error: function () {
                    alert('提交异常');
                }
            });

        });
    });
</script>
</body>
</html>